<!--查询按钮-->
<template>
  <span
    class="queryRight"
    :style="{ float: floatPath }"
    :class="showHide ? 'chooseRight' : ''"
    @click="showClick"
  >
    <i class="el-icon-search"></i>
    <span class="text">{{ textList }}</span>
  </span>
</template>
<script>
export default {
  props: {
    text: {
      type: String,
      default: () => "",
    },
    floatPath: {
      type: String,
      default: "right",
    },
    show: {
      type: Boolean,
      default: false,
    },
    disabled: {
      type: Boolean,
      default: false,
    },
  },
  computed: {
    showHide() {
      return this.disabled ? this.show : this.$store.state.user.queryShow;
    },
    textList() {
      return this.text ? this.text : this.$t("common.common6");
    },
  },
  methods: {
    showClick() {
      if (this.disabled) {
        this.$emit("update:show", !this.showHide);
      } else {
        this.$store.dispatch("setQuery", !this.showHide);
      }
    },
  },
  watch: {
    showHide(val) {
      console.log(val);
      if (this.disabled) {
        this.$emit("update:show", val);
      } else {
        this.$store.dispatch("setQuery", val);
      }
    },
  },
};
</script>